import 'package:flutter/material.dart';

extension WidgetExt on Widget {
  Widget get center {
    return Center(child: this);
  }

  Widget get expand {
    return Expanded(child: this);
  }

  Widget get vscroll {
    return SingleChildScrollView(child: this);
  }

  Widget get intrinsicHeight {
    return IntrinsicHeight(child: this);
  }

  Widget size(double height, double width) {
    return SizedBox(height: height, width: width, child: this);
  }

  Widget padding(EdgeInsetsGeometry padding) {
    return Padding(padding: padding, child: this);
  }

  Widget onTap(VoidCallback? onTap) {
    return GestureDetector(
        behavior: HitTestBehavior.opaque, child: this, onTap: onTap);
  }

  Widget onDoubleTap(VoidCallback? onDoubleTap) {
    return GestureDetector(
        behavior: HitTestBehavior.opaque,
        child: this,
        onDoubleTap: onDoubleTap);
  }

  Widget align(AlignmentGeometry align) {
    return Align(alignment: align, child: this);
  }
}
